#ifndef PICCOLO_VK_IMAGE_H
#define PICCOLO_VK_IMAGE_H

#include "PiccoloVKCommon.h"

namespace Piccolo
{
    class PiccoloVKDevice;
    class PiccoloVKBuffer;

    class PiccoloVKImage
    {
    public:
        PiccoloVKImage(PiccoloVKDevice* device, VkExtent3D extent, VkFormat format, VkImageUsageFlags usage, VkSampleCountFlagBits sampleCount = VK_SAMPLE_COUNT_1_BIT);
        PiccoloVKImage(PiccoloVKDevice* device, VkImage image, VkExtent3D extent, VkFormat format, VkImageUsageFlags usage, VkSampleCountFlagBits sampleCount = VK_SAMPLE_COUNT_1_BIT);
        ~PiccoloVKImage();

        static bool TransitionLayout(VkCommandBuffer cmdBuffer, VkImage image, VkImageLayout oldLayout, VkImageLayout newLayout);

        void CopyFromBuffer(VkCommandBuffer cmdBuffer, PiccoloVKBuffer* buffer);

        VkFormat GetFormat() const { return mFormat; }
        VkImage GetImage() const { return mImage; }

    private:
        VkImage mImage = VK_NULL_HANDLE;
        VkDeviceMemory mDeviceMemory = VK_NULL_HANDLE;
        VkFormat mFormat;
        VkExtent3D mExtent;
        VkImageUsageFlags mUsage;

        PiccoloVKDevice* mDevice;

        bool bCreateImage = true;
    };
}

#endif